package com.alibaba.fastjson.parser;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.JSONPathException;
import com.alibaba.fastjson.parser.deserializer.ExtraProcessable;
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
import com.alibaba.fastjson.parser.deserializer.ExtraTypeProvider;
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.FieldTypeResolver;
import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;
import com.alibaba.fastjson.parser.deserializer.ResolveFieldDeserializer;
import com.alibaba.fastjson.serializer.BeanContext;
import com.alibaba.fastjson.serializer.IntegerCodec;
import com.alibaba.fastjson.serializer.LongCodec;
import com.alibaba.fastjson.serializer.StringCodec;
import com.alibaba.fastjson.util.TypeUtils;
import java.io.Closeable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

/* loaded from: classes.dex */
public class DefaultJSONParser implements Closeable {
    public static final int NONE = 0;
    public static final int NeedToResolve = 1;
    public static final int TypeNameRedirect = 2;
    private static final Set<Class<?>> primitiveClasses = new HashSet();
    private String[] autoTypeAccept;
    private boolean autoTypeEnable;
    protected ParserConfig config;
    protected ParseContext context;
    private ParseContext[] contextArray;
    private int contextArrayIndex;
    private DateFormat dateFormat;
    private String dateFormatPattern;
    private List<ExtraProcessor> extraProcessors;
    private List<ExtraTypeProvider> extraTypeProviders;
    protected FieldTypeResolver fieldTypeResolver;
    public final Object input;
    protected transient BeanContext lastBeanContext;
    public final JSONLexer lexer;
    private int objectKeyLevel;
    public int resolveStatus;
    private List<ResolveTask> resolveTaskList;
    public final SymbolTable symbolTable;

    static {
        for (Class<?> cls : new Class[]{Boolean.TYPE, Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE, Boolean.class, Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class, BigInteger.class, BigDecimal.class, String.class}) {
            primitiveClasses.add(cls);
        }
    }

    public String getDateFomartPattern() {
        return this.dateFormatPattern;
    }

    public DateFormat getDateFormat() {
        if (this.dateFormat == null) {
            this.dateFormat = new SimpleDateFormat(this.dateFormatPattern, this.lexer.getLocale());
            this.dateFormat.setTimeZone(this.lexer.getTimeZone());
        }
        return this.dateFormat;
    }

    public void setDateFormat(String str) {
        this.dateFormatPattern = str;
        this.dateFormat = null;
    }

    public void setDateFomrat(DateFormat dateFormat) {
        this.dateFormat = dateFormat;
    }

    public DefaultJSONParser(String str) {
        this(str, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
    }

    public DefaultJSONParser(String str, ParserConfig parserConfig) {
        this(str, new JSONScanner(str, JSON.DEFAULT_PARSER_FEATURE), parserConfig);
    }

    public DefaultJSONParser(String str, ParserConfig parserConfig, int i) {
        this(str, new JSONScanner(str, i), parserConfig);
    }

    public DefaultJSONParser(char[] cArr, int i, ParserConfig parserConfig, int i2) {
        this(cArr, new JSONScanner(cArr, i, i2), parserConfig);
    }

    public DefaultJSONParser(JSONLexer jSONLexer) {
        this(jSONLexer, ParserConfig.getGlobalInstance());
    }

    public DefaultJSONParser(JSONLexer jSONLexer, ParserConfig parserConfig) {
        this((Object) null, jSONLexer, parserConfig);
    }

    public DefaultJSONParser(Object obj, JSONLexer jSONLexer, ParserConfig parserConfig) {
        this.dateFormatPattern = JSON.DEFFAULT_DATE_FORMAT;
        this.contextArrayIndex = 0;
        this.resolveStatus = 0;
        this.extraTypeProviders = null;
        this.extraProcessors = null;
        this.fieldTypeResolver = null;
        this.objectKeyLevel = 0;
        this.autoTypeAccept = null;
        this.lexer = jSONLexer;
        this.input = obj;
        this.config = parserConfig;
        this.symbolTable = parserConfig.symbolTable;
        char current = jSONLexer.getCurrent();
        if (current == '{') {
            jSONLexer.next();
            ((JSONLexerBase) jSONLexer).token = 12;
        } else if (current == '[') {
            jSONLexer.next();
            ((JSONLexerBase) jSONLexer).token = 14;
        } else {
            jSONLexer.nextToken();
        }
    }

    public SymbolTable getSymbolTable() {
        return this.symbolTable;
    }

    public String getInput() {
        Object obj = this.input;
        if (obj instanceof char[]) {
            return new String((char[]) obj);
        }
        return obj.toString();
    }

    /* JADX WARN: Code restructure failed: missing block: B:142:0x0291, code lost:
        r3.nextToken(16);
     */
    /* JADX WARN: Code restructure failed: missing block: B:143:0x029c, code lost:
        if (r3.token() != 13) goto L82;
     */
    /* JADX WARN: Code restructure failed: missing block: B:144:0x029e, code lost:
        r3.nextToken(16);
     */
    /* JADX WARN: Code restructure failed: missing block: B:146:0x02a9, code lost:
        if ((r17.config.getDeserializer(r6) instanceof com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer) == false) goto L78;
     */
    /* JADX WARN: Code restructure failed: missing block: B:147:0x02ab, code lost:
        r0 = com.alibaba.fastjson.util.TypeUtils.cast((java.lang.Object) r18, (java.lang.Class<java.lang.Object>) r6, r17.config);
     */
    /* JADX WARN: Code restructure failed: missing block: B:148:0x02b2, code lost:
        r0 = r11;
     */
    /* JADX WARN: Code restructure failed: missing block: B:149:0x02b3, code lost:
        if (r0 != null) goto L76;
     */
    /* JADX WARN: Code restructure failed: missing block: B:151:0x02b7, code lost:
        if (r6 != java.lang.Cloneable.class) goto L69;
     */
    /* JADX WARN: Code restructure failed: missing block: B:152:0x02b9, code lost:
        r0 = new java.util.HashMap();
     */
    /* JADX WARN: Code restructure failed: missing block: B:154:0x02c5, code lost:
        if ("java.util.Collections$EmptyMap".equals(r5) == false) goto L72;
     */
    /* JADX WARN: Code restructure failed: missing block: B:155:0x02c7, code lost:
        r0 = java.util.Collections.emptyMap();
     */
    /* JADX WARN: Code restructure failed: missing block: B:157:0x02d2, code lost:
        if ("java.util.Collections$UnmodifiableMap".equals(r5) == false) goto L75;
     */
    /* JADX WARN: Code restructure failed: missing block: B:158:0x02d4, code lost:
        r0 = java.util.Collections.unmodifiableMap(new java.util.HashMap());
     */
    /* JADX WARN: Code restructure failed: missing block: B:159:0x02de, code lost:
        r0 = r6.newInstance();
     */
    /* JADX WARN: Code restructure failed: missing block: B:160:0x02e2, code lost:
        setContext(r12);
     */
    /* JADX WARN: Code restructure failed: missing block: B:161:0x02e5, code lost:
        return r0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:162:0x02e6, code lost:
        r0 = move-exception;
     */
    /* JADX WARN: Code restructure failed: missing block: B:164:0x02ee, code lost:
        throw new com.alibaba.fastjson.JSONException("create instance error", r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:165:0x02ef, code lost:
        setResolveStatus(2);
     */
    /* JADX WARN: Code restructure failed: missing block: B:166:0x02f5, code lost:
        if (r17.context == null) goto L90;
     */
    /* JADX WARN: Code restructure failed: missing block: B:167:0x02f7, code lost:
        if (r19 == null) goto L90;
     */
    /* JADX WARN: Code restructure failed: missing block: B:169:0x02fb, code lost:
        if ((r19 instanceof java.lang.Integer) != false) goto L90;
     */
    /* JADX WARN: Code restructure failed: missing block: B:171:0x0303, code lost:
        if ((r17.context.fieldName instanceof java.lang.Integer) != false) goto L90;
     */
    /* JADX WARN: Code restructure failed: missing block: B:172:0x0305, code lost:
        popContext();
     */
    /* JADX WARN: Code restructure failed: missing block: B:174:0x030c, code lost:
        if (r18.size() <= 0) goto L95;
     */
    /* JADX WARN: Code restructure failed: missing block: B:175:0x030e, code lost:
        r0 = com.alibaba.fastjson.util.TypeUtils.cast((java.lang.Object) r18, (java.lang.Class<java.lang.Object>) r6, r17.config);
        setResolveStatus(0);
        parseObject(r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:176:0x031b, code lost:
        setContext(r12);
     */
    /* JADX WARN: Code restructure failed: missing block: B:177:0x031e, code lost:
        return r0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:178:0x031f, code lost:
        r0 = r17.config.getDeserializer(r6);
        r3 = r0.getClass();
     */
    /* JADX WARN: Code restructure failed: missing block: B:179:0x032f, code lost:
        if (com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.class.isAssignableFrom(r3) == false) goto L105;
     */
    /* JADX WARN: Code restructure failed: missing block: B:181:0x0333, code lost:
        if (r3 == com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer.class) goto L105;
     */
    /* JADX WARN: Code restructure failed: missing block: B:183:0x0337, code lost:
        if (r3 == com.alibaba.fastjson.parser.deserializer.ThrowableDeserializer.class) goto L105;
     */
    /* JADX WARN: Code restructure failed: missing block: B:184:0x0339, code lost:
        setResolveStatus(0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:186:0x0340, code lost:
        if ((r0 instanceof com.alibaba.fastjson.parser.deserializer.MapDeserializer) == false) goto L102;
     */
    /* JADX WARN: Code restructure failed: missing block: B:187:0x0342, code lost:
        setResolveStatus(0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:188:0x0346, code lost:
        r0 = r0.deserialze(r17, r6, r19);
     */
    /* JADX WARN: Code restructure failed: missing block: B:189:0x034a, code lost:
        setContext(r12);
     */
    /* JADX WARN: Code restructure failed: missing block: B:190:0x034d, code lost:
        return r0;
     */
    /* JADX WARN: Removed duplicated region for block: B:115:0x021c A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:245:0x043e A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:263:0x046c A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:270:0x0495  */
    /* JADX WARN: Removed duplicated region for block: B:283:0x04c6 A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:340:0x05cd A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:345:0x05d9 A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:348:0x05e5 A[Catch: all -> 0x0685, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:354:0x05fa A[Catch: all -> 0x0685, TRY_ENTER, TryCatch #0 {all -> 0x0685, blocks: (B:30:0x0080, B:33:0x0093, B:37:0x00ac, B:115:0x021c, B:116:0x0222, B:118:0x022d, B:120:0x0235, B:124:0x024b, B:126:0x0259, B:141:0x0289, B:142:0x0291, B:144:0x029e, B:145:0x02a1, B:147:0x02ab, B:152:0x02b9, B:153:0x02bf, B:155:0x02c7, B:156:0x02cc, B:158:0x02d4, B:159:0x02de, B:163:0x02e7, B:164:0x02ee, B:165:0x02ef, B:168:0x02f9, B:170:0x02fd, B:172:0x0305, B:173:0x0308, B:175:0x030e, B:178:0x031f, B:184:0x0339, B:188:0x0346, B:185:0x033e, B:187:0x0342, B:128:0x0260, B:130:0x0266, B:135:0x0273, B:138:0x0279, B:195:0x0355, B:197:0x035d, B:199:0x0367, B:201:0x0378, B:204:0x0382, B:206:0x038a, B:208:0x038e, B:210:0x0396, B:213:0x039b, B:215:0x039f, B:234:0x03ef, B:236:0x03f7, B:239:0x0400, B:240:0x041b, B:216:0x03a4, B:218:0x03ac, B:220:0x03b0, B:221:0x03b3, B:222:0x03bf, B:225:0x03c8, B:227:0x03cc, B:228:0x03cf, B:230:0x03d3, B:231:0x03d7, B:232:0x03e3, B:241:0x041c, B:242:0x043a, B:245:0x043e, B:247:0x0442, B:249:0x0448, B:251:0x044e, B:252:0x0452, B:257:0x045c, B:263:0x046c, B:265:0x047b, B:267:0x0486, B:268:0x048e, B:269:0x0491, B:281:0x04bd, B:283:0x04c6, B:287:0x04d3, B:290:0x04e3, B:291:0x0504, B:276:0x04a1, B:278:0x04ab, B:280:0x04ba, B:279:0x04b0, B:294:0x0509, B:296:0x0513, B:298:0x051b, B:299:0x051e, B:301:0x0529, B:302:0x052d, B:304:0x0538, B:307:0x053f, B:310:0x054b, B:311:0x0550, B:314:0x0555, B:316:0x055a, B:320:0x0565, B:322:0x056d, B:324:0x0582, B:328:0x05a1, B:330:0x05a7, B:333:0x05ad, B:335:0x05b3, B:337:0x05bb, B:340:0x05cd, B:343:0x05d5, B:345:0x05d9, B:346:0x05e0, B:348:0x05e5, B:349:0x05e8, B:351:0x05f0, B:354:0x05fa, B:357:0x0604, B:358:0x0609, B:359:0x060e, B:360:0x0629, B:325:0x058d, B:326:0x0594, B:361:0x062a, B:363:0x063c, B:366:0x0643, B:369:0x064f, B:370:0x0670, B:40:0x00be, B:41:0x00dc, B:44:0x00e1, B:46:0x00ec, B:48:0x00f0, B:50:0x00f6, B:52:0x00fc, B:53:0x00ff, B:60:0x010e, B:62:0x0116, B:65:0x0128, B:66:0x0140, B:67:0x0141, B:68:0x0146, B:78:0x0159, B:79:0x015f, B:81:0x0166, B:83:0x016f, B:90:0x0181, B:93:0x0189, B:94:0x01a3, B:88:0x017c, B:82:0x016b, B:95:0x01a4, B:96:0x01be, B:102:0x01c8, B:104:0x01d0, B:107:0x01e1, B:108:0x0201, B:109:0x0202, B:110:0x0207, B:111:0x0208, B:113:0x0212, B:371:0x0671, B:372:0x0678, B:373:0x0679, B:374:0x067e, B:375:0x067f, B:376:0x0684), top: B:384:0x0080, inners: #1, #3 }] */
    /* JADX WARN: Removed duplicated region for block: B:396:0x04cf A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:406:0x0189 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:409:0x05f0 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:92:0x0187  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final java.lang.Object parseObject(java.util.Map r18, java.lang.Object r19) {
        /*
            Method dump skipped, instructions count: 1679
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(java.util.Map, java.lang.Object):java.lang.Object");
    }

    public ParserConfig getConfig() {
        return this.config;
    }

    public void setConfig(ParserConfig parserConfig) {
        this.config = parserConfig;
    }

    public <T> T parseObject(Class<T> cls) {
        return (T) parseObject(cls, (Object) null);
    }

    public <T> T parseObject(Type type) {
        return (T) parseObject(type, (Object) null);
    }

    public <T> T parseObject(Type type, Object obj) {
        int i = this.lexer.token();
        if (i == 8) {
            this.lexer.nextToken();
            return null;
        }
        if (i == 4) {
            if (type == byte[].class) {
                T t = (T) this.lexer.bytesValue();
                this.lexer.nextToken();
                return t;
            } else if (type == char[].class) {
                String stringVal = this.lexer.stringVal();
                this.lexer.nextToken();
                return (T) stringVal.toCharArray();
            }
        }
        ObjectDeserializer deserializer = this.config.getDeserializer(type);
        try {
            if (deserializer.getClass() == JavaBeanDeserializer.class) {
                if (this.lexer.token() != 12 && this.lexer.token() != 14) {
                    throw new JSONException("syntax error,except start with { or [,but actually start with " + this.lexer.tokenName());
                }
                return (T) ((JavaBeanDeserializer) deserializer).deserialze(this, type, obj, 0);
            }
            return (T) deserializer.deserialze(this, type, obj);
        } catch (JSONException e) {
            throw e;
        } catch (Throwable th) {
            throw new JSONException(th.getMessage(), th);
        }
    }

    public <T> List<T> parseArray(Class<T> cls) {
        ArrayList arrayList = new ArrayList();
        parseArray((Class<?>) cls, (Collection) arrayList);
        return arrayList;
    }

    public void parseArray(Class<?> cls, Collection collection) {
        parseArray((Type) cls, collection);
    }

    public void parseArray(Type type, Collection collection) {
        parseArray(type, collection, null);
    }

    public void parseArray(Type type, Collection collection, Object obj) {
        ObjectDeserializer deserializer;
        int i = this.lexer.token();
        if (i == 21 || i == 22) {
            this.lexer.nextToken();
            i = this.lexer.token();
        }
        if (i != 14) {
            throw new JSONException("expect '[', but " + JSONToken.name(i) + ", " + this.lexer.info());
        }
        if (Integer.TYPE == type) {
            deserializer = IntegerCodec.instance;
            this.lexer.nextToken(2);
        } else if (String.class == type) {
            deserializer = StringCodec.instance;
            this.lexer.nextToken(4);
        } else {
            deserializer = this.config.getDeserializer(type);
            this.lexer.nextToken(deserializer.getFastMatchToken());
        }
        ParseContext parseContext = this.context;
        setContext(collection, obj);
        int i2 = 0;
        while (true) {
            try {
                if (this.lexer.isEnabled(Feature.AllowArbitraryCommas)) {
                    while (this.lexer.token() == 16) {
                        this.lexer.nextToken();
                    }
                }
                if (this.lexer.token() != 15) {
                    Object obj2 = null;
                    if (Integer.TYPE == type) {
                        collection.add(IntegerCodec.instance.deserialze(this, null, null));
                    } else if (String.class == type) {
                        if (this.lexer.token() == 4) {
                            obj2 = this.lexer.stringVal();
                            this.lexer.nextToken(16);
                        } else {
                            Object parse = parse();
                            if (parse != null) {
                                obj2 = parse.toString();
                            }
                        }
                        collection.add(obj2);
                    } else {
                        if (this.lexer.token() == 8) {
                            this.lexer.nextToken();
                        } else {
                            obj2 = deserializer.deserialze(this, type, Integer.valueOf(i2));
                        }
                        collection.add(obj2);
                        checkListResolve(collection);
                    }
                    if (this.lexer.token() == 16) {
                        this.lexer.nextToken(deserializer.getFastMatchToken());
                    }
                    i2++;
                } else {
                    setContext(parseContext);
                    this.lexer.nextToken(16);
                    return;
                }
            } catch (Throwable th) {
                setContext(parseContext);
                throw th;
            }
        }
    }

    public Object[] parseArray(Type[] typeArr) {
        Object cast;
        Class<?> cls;
        boolean z;
        Class cls2;
        Object cast2;
        int i = 8;
        if (this.lexer.token() == 8) {
            this.lexer.nextToken(16);
            return null;
        }
        int i2 = 14;
        if (this.lexer.token() != 14) {
            throw new JSONException("syntax error : " + this.lexer.tokenName());
        }
        Object[] objArr = new Object[typeArr.length];
        if (typeArr.length == 0) {
            this.lexer.nextToken(15);
            if (this.lexer.token() != 15) {
                throw new JSONException("syntax error");
            }
            this.lexer.nextToken(16);
            return new Object[0];
        }
        this.lexer.nextToken(2);
        int i3 = 0;
        while (i3 < typeArr.length) {
            if (this.lexer.token() == i) {
                this.lexer.nextToken(16);
                cast = null;
            } else {
                Type type = typeArr[i3];
                if (type == Integer.TYPE || type == Integer.class) {
                    if (this.lexer.token() == 2) {
                        cast = Integer.valueOf(this.lexer.intValue());
                        this.lexer.nextToken(16);
                    } else {
                        cast = TypeUtils.cast(parse(), type, this.config);
                    }
                } else if (type == String.class) {
                    if (this.lexer.token() == 4) {
                        cast2 = this.lexer.stringVal();
                        this.lexer.nextToken(16);
                    } else {
                        cast2 = TypeUtils.cast(parse(), type, this.config);
                    }
                    cast = cast2;
                } else {
                    if (i3 == typeArr.length - 1 && (type instanceof Class) && (((cls2 = (Class) type) != byte[].class && cls2 != char[].class) || this.lexer.token() != 4)) {
                        z = cls2.isArray();
                        cls = cls2.getComponentType();
                    } else {
                        cls = null;
                        z = false;
                    }
                    if (z && this.lexer.token() != i2) {
                        ArrayList arrayList = new ArrayList();
                        ObjectDeserializer deserializer = this.config.getDeserializer(cls);
                        int fastMatchToken = deserializer.getFastMatchToken();
                        if (this.lexer.token() != 15) {
                            while (true) {
                                arrayList.add(deserializer.deserialze(this, type, null));
                                if (this.lexer.token() != 16) {
                                    break;
                                }
                                this.lexer.nextToken(fastMatchToken);
                            }
                            if (this.lexer.token() != 15) {
                                throw new JSONException("syntax error :" + JSONToken.name(this.lexer.token()));
                            }
                        }
                        cast = TypeUtils.cast(arrayList, type, this.config);
                    } else {
                        cast = this.config.getDeserializer(type).deserialze(this, type, Integer.valueOf(i3));
                    }
                }
            }
            objArr[i3] = cast;
            if (this.lexer.token() == 15) {
                break;
            } else if (this.lexer.token() != 16) {
                throw new JSONException("syntax error :" + JSONToken.name(this.lexer.token()));
            } else {
                if (i3 == typeArr.length - 1) {
                    this.lexer.nextToken(15);
                } else {
                    this.lexer.nextToken(2);
                }
                i3++;
                i = 8;
                i2 = 14;
            }
        }
        if (this.lexer.token() != 15) {
            throw new JSONException("syntax error");
        }
        this.lexer.nextToken(16);
        return objArr;
    }

    public void parseObject(Object obj) {
        Object deserialze;
        Class<?> cls = obj.getClass();
        ObjectDeserializer deserializer = this.config.getDeserializer(cls);
        JavaBeanDeserializer javaBeanDeserializer = deserializer instanceof JavaBeanDeserializer ? (JavaBeanDeserializer) deserializer : null;
        if (this.lexer.token() != 12 && this.lexer.token() != 16) {
            throw new JSONException("syntax error, expect {, actual " + this.lexer.tokenName());
        }
        while (true) {
            String scanSymbol = this.lexer.scanSymbol(this.symbolTable);
            if (scanSymbol == null) {
                if (this.lexer.token() == 13) {
                    this.lexer.nextToken(16);
                    return;
                } else if (this.lexer.token() == 16 && this.lexer.isEnabled(Feature.AllowArbitraryCommas)) {
                }
            }
            FieldDeserializer fieldDeserializer = javaBeanDeserializer != null ? javaBeanDeserializer.getFieldDeserializer(scanSymbol) : null;
            if (fieldDeserializer == null) {
                if (!this.lexer.isEnabled(Feature.IgnoreNotMatch)) {
                    throw new JSONException("setter not found, class " + cls.getName() + ", property " + scanSymbol);
                }
                this.lexer.nextTokenWithColon();
                parse();
                if (this.lexer.token() == 13) {
                    this.lexer.nextToken();
                    return;
                }
            } else {
                Class<?> cls2 = fieldDeserializer.fieldInfo.fieldClass;
                Type type = fieldDeserializer.fieldInfo.fieldType;
                if (cls2 == Integer.TYPE) {
                    this.lexer.nextTokenWithColon(2);
                    deserialze = IntegerCodec.instance.deserialze(this, type, null);
                } else if (cls2 == String.class) {
                    this.lexer.nextTokenWithColon(4);
                    deserialze = StringCodec.deserialze(this);
                } else if (cls2 == Long.TYPE) {
                    this.lexer.nextTokenWithColon(2);
                    deserialze = LongCodec.instance.deserialze(this, type, null);
                } else {
                    ObjectDeserializer deserializer2 = this.config.getDeserializer(cls2, type);
                    this.lexer.nextTokenWithColon(deserializer2.getFastMatchToken());
                    deserialze = deserializer2.deserialze(this, type, null);
                }
                fieldDeserializer.setValue(obj, deserialze);
                if (this.lexer.token() != 16 && this.lexer.token() == 13) {
                    this.lexer.nextToken(16);
                    return;
                }
            }
        }
    }

    public Object parseArrayWithType(Type type) {
        if (this.lexer.token() == 8) {
            this.lexer.nextToken();
            return null;
        }
        Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
        if (actualTypeArguments.length != 1) {
            throw new JSONException("not support type " + type);
        }
        Type type2 = actualTypeArguments[0];
        if (type2 instanceof Class) {
            ArrayList arrayList = new ArrayList();
            parseArray((Class) type2, (Collection) arrayList);
            return arrayList;
        } else if (type2 instanceof WildcardType) {
            WildcardType wildcardType = (WildcardType) type2;
            Type type3 = wildcardType.getUpperBounds()[0];
            if (Object.class.equals(type3)) {
                if (wildcardType.getLowerBounds().length == 0) {
                    return parse();
                }
                throw new JSONException("not support type : " + type);
            }
            ArrayList arrayList2 = new ArrayList();
            parseArray((Class) type3, (Collection) arrayList2);
            return arrayList2;
        } else {
            if (type2 instanceof TypeVariable) {
                TypeVariable typeVariable = (TypeVariable) type2;
                Type[] bounds = typeVariable.getBounds();
                if (bounds.length != 1) {
                    throw new JSONException("not support : " + typeVariable);
                }
                Type type4 = bounds[0];
                if (type4 instanceof Class) {
                    ArrayList arrayList3 = new ArrayList();
                    parseArray((Class) type4, (Collection) arrayList3);
                    return arrayList3;
                }
            }
            if (type2 instanceof ParameterizedType) {
                ArrayList arrayList4 = new ArrayList();
                parseArray((ParameterizedType) type2, arrayList4);
                return arrayList4;
            }
            throw new JSONException("TODO : " + type);
        }
    }

    public void acceptType(String str) {
        JSONLexer jSONLexer = this.lexer;
        jSONLexer.nextTokenWithColon();
        if (jSONLexer.token() != 4) {
            throw new JSONException("type not match error");
        }
        if (str.equals(jSONLexer.stringVal())) {
            jSONLexer.nextToken();
            if (jSONLexer.token() == 16) {
                jSONLexer.nextToken();
                return;
            }
            return;
        }
        throw new JSONException("type not match error");
    }

    public int getResolveStatus() {
        return this.resolveStatus;
    }

    public void setResolveStatus(int i) {
        this.resolveStatus = i;
    }

    public Object getObject(String str) {
        for (int i = 0; i < this.contextArrayIndex; i++) {
            if (str.equals(this.contextArray[i].toString())) {
                return this.contextArray[i].object;
            }
        }
        return null;
    }

    public void checkListResolve(Collection collection) {
        if (this.resolveStatus == 1) {
            if (collection instanceof List) {
                ResolveTask lastResolveTask = getLastResolveTask();
                lastResolveTask.fieldDeserializer = new ResolveFieldDeserializer(this, (List) collection, collection.size() - 1);
                lastResolveTask.ownerContext = this.context;
                setResolveStatus(0);
                return;
            }
            ResolveTask lastResolveTask2 = getLastResolveTask();
            lastResolveTask2.fieldDeserializer = new ResolveFieldDeserializer(collection);
            lastResolveTask2.ownerContext = this.context;
            setResolveStatus(0);
        }
    }

    public void checkMapResolve(Map map, Object obj) {
        if (this.resolveStatus == 1) {
            ResolveFieldDeserializer resolveFieldDeserializer = new ResolveFieldDeserializer(map, obj);
            ResolveTask lastResolveTask = getLastResolveTask();
            lastResolveTask.fieldDeserializer = resolveFieldDeserializer;
            lastResolveTask.ownerContext = this.context;
            setResolveStatus(0);
        }
    }

    public Object parseObject(Map map) {
        return parseObject(map, (Object) null);
    }

    public JSONObject parseObject() {
        Object parseObject = parseObject((Map) new JSONObject(this.lexer.isEnabled(Feature.OrderedField)));
        if (parseObject instanceof JSONObject) {
            return (JSONObject) parseObject;
        }
        if (parseObject == null) {
            return null;
        }
        return new JSONObject((Map) parseObject);
    }

    public final void parseArray(Collection collection) {
        parseArray(collection, (Object) null);
    }

    public final void parseArray(Collection collection, Object obj) {
        Number decimalValue;
        JSONLexer jSONLexer = this.lexer;
        if (jSONLexer.token() == 21 || jSONLexer.token() == 22) {
            jSONLexer.nextToken();
        }
        if (jSONLexer.token() != 14) {
            throw new JSONException("syntax error, expect [, actual " + JSONToken.name(jSONLexer.token()) + ", pos " + jSONLexer.pos() + ", fieldName " + obj);
        }
        jSONLexer.nextToken(4);
        ParseContext parseContext = this.context;
        if (parseContext != null && parseContext.level > 512) {
            throw new JSONException("array level > 512");
        }
        ParseContext parseContext2 = this.context;
        setContext(collection, obj);
        int i = 0;
        while (true) {
            try {
                if (jSONLexer.isEnabled(Feature.AllowArbitraryCommas)) {
                    while (jSONLexer.token() == 16) {
                        jSONLexer.nextToken();
                    }
                }
                int i2 = jSONLexer.token();
                Number number = null;
                number = null;
                if (i2 == 2) {
                    Number integerValue = jSONLexer.integerValue();
                    jSONLexer.nextToken(16);
                    number = integerValue;
                } else if (i2 == 3) {
                    if (jSONLexer.isEnabled(Feature.UseBigDecimal)) {
                        decimalValue = jSONLexer.decimalValue(true);
                    } else {
                        decimalValue = jSONLexer.decimalValue(false);
                    }
                    number = decimalValue;
                    jSONLexer.nextToken(16);
                } else if (i2 == 4) {
                    String stringVal = jSONLexer.stringVal();
                    jSONLexer.nextToken(16);
                    number = stringVal;
                    if (jSONLexer.isEnabled(Feature.AllowISO8601DateFormat)) {
                        JSONScanner jSONScanner = new JSONScanner(stringVal);
                        Date date = stringVal;
                        if (jSONScanner.scanISO8601DateIfMatch()) {
                            date = jSONScanner.getCalendar().getTime();
                        }
                        jSONScanner.close();
                        number = date;
                    }
                } else if (i2 == 6) {
                    Boolean bool = Boolean.TRUE;
                    jSONLexer.nextToken(16);
                    number = bool;
                } else if (i2 == 7) {
                    Boolean bool2 = Boolean.FALSE;
                    jSONLexer.nextToken(16);
                    number = bool2;
                } else if (i2 == 8) {
                    jSONLexer.nextToken(4);
                } else if (i2 == 12) {
                    number = parseObject(new JSONObject(jSONLexer.isEnabled(Feature.OrderedField)), Integer.valueOf(i));
                } else if (i2 == 20) {
                    throw new JSONException("unclosed jsonArray");
                } else {
                    if (i2 == 23) {
                        jSONLexer.nextToken(4);
                    } else if (i2 == 14) {
                        JSONArray jSONArray = new JSONArray();
                        parseArray(jSONArray, Integer.valueOf(i));
                        number = jSONArray;
                        if (jSONLexer.isEnabled(Feature.UseObjectArray)) {
                            number = jSONArray.toArray();
                        }
                    } else if (i2 == 15) {
                        jSONLexer.nextToken(16);
                        return;
                    } else {
                        number = parse();
                    }
                }
                collection.add(number);
                checkListResolve(collection);
                if (jSONLexer.token() == 16) {
                    jSONLexer.nextToken(4);
                }
                i++;
            } finally {
                setContext(parseContext2);
            }
        }
    }

    public ParseContext getContext() {
        return this.context;
    }

    public List<ResolveTask> getResolveTaskList() {
        if (this.resolveTaskList == null) {
            this.resolveTaskList = new ArrayList(2);
        }
        return this.resolveTaskList;
    }

    public void addResolveTask(ResolveTask resolveTask) {
        if (this.resolveTaskList == null) {
            this.resolveTaskList = new ArrayList(2);
        }
        this.resolveTaskList.add(resolveTask);
    }

    public ResolveTask getLastResolveTask() {
        List<ResolveTask> list = this.resolveTaskList;
        return list.get(list.size() - 1);
    }

    public List<ExtraProcessor> getExtraProcessors() {
        if (this.extraProcessors == null) {
            this.extraProcessors = new ArrayList(2);
        }
        return this.extraProcessors;
    }

    public List<ExtraTypeProvider> getExtraTypeProviders() {
        if (this.extraTypeProviders == null) {
            this.extraTypeProviders = new ArrayList(2);
        }
        return this.extraTypeProviders;
    }

    public FieldTypeResolver getFieldTypeResolver() {
        return this.fieldTypeResolver;
    }

    public void setFieldTypeResolver(FieldTypeResolver fieldTypeResolver) {
        this.fieldTypeResolver = fieldTypeResolver;
    }

    public void setContext(ParseContext parseContext) {
        if (this.lexer.isEnabled(Feature.DisableCircularReferenceDetect)) {
            return;
        }
        this.context = parseContext;
    }

    public void popContext() {
        if (this.lexer.isEnabled(Feature.DisableCircularReferenceDetect)) {
            return;
        }
        this.context = this.context.parent;
        int i = this.contextArrayIndex;
        if (i <= 0) {
            return;
        }
        this.contextArrayIndex = i - 1;
        this.contextArray[this.contextArrayIndex] = null;
    }

    public ParseContext setContext(Object obj, Object obj2) {
        if (this.lexer.isEnabled(Feature.DisableCircularReferenceDetect)) {
            return null;
        }
        return setContext(this.context, obj, obj2);
    }

    public ParseContext setContext(ParseContext parseContext, Object obj, Object obj2) {
        if (this.lexer.isEnabled(Feature.DisableCircularReferenceDetect)) {
            return null;
        }
        this.context = new ParseContext(parseContext, obj, obj2);
        addContext(this.context);
        return this.context;
    }

    private void addContext(ParseContext parseContext) {
        int i = this.contextArrayIndex;
        this.contextArrayIndex = i + 1;
        ParseContext[] parseContextArr = this.contextArray;
        if (parseContextArr == null) {
            this.contextArray = new ParseContext[8];
        } else if (i >= parseContextArr.length) {
            ParseContext[] parseContextArr2 = new ParseContext[(parseContextArr.length * 3) / 2];
            System.arraycopy(parseContextArr, 0, parseContextArr2, 0, parseContextArr.length);
            this.contextArray = parseContextArr2;
        }
        this.contextArray[i] = parseContext;
    }

    public Object parse() {
        return parse(null);
    }

    public Object parseKey() {
        if (this.lexer.token() == 18) {
            String stringVal = this.lexer.stringVal();
            this.lexer.nextToken(16);
            return stringVal;
        }
        return parse(null);
    }

    public Object parse(Object obj) {
        JSONLexer jSONLexer = this.lexer;
        int i = jSONLexer.token();
        if (i == 2) {
            Number integerValue = jSONLexer.integerValue();
            jSONLexer.nextToken();
            return integerValue;
        } else if (i == 3) {
            Number decimalValue = jSONLexer.decimalValue(jSONLexer.isEnabled(Feature.UseBigDecimal));
            jSONLexer.nextToken();
            return decimalValue;
        } else if (i == 4) {
            String stringVal = jSONLexer.stringVal();
            jSONLexer.nextToken(16);
            if (jSONLexer.isEnabled(Feature.AllowISO8601DateFormat)) {
                JSONScanner jSONScanner = new JSONScanner(stringVal);
                try {
                    if (jSONScanner.scanISO8601DateIfMatch()) {
                        return jSONScanner.getCalendar().getTime();
                    }
                } finally {
                    jSONScanner.close();
                }
            }
            return stringVal;
        } else if (i != 12) {
            if (i == 14) {
                JSONArray jSONArray = new JSONArray();
                parseArray(jSONArray, obj);
                return jSONLexer.isEnabled(Feature.UseObjectArray) ? jSONArray.toArray() : jSONArray;
            } else if (i == 18) {
                if ("NaN".equals(jSONLexer.stringVal())) {
                    jSONLexer.nextToken();
                    return null;
                }
                throw new JSONException("syntax error, " + jSONLexer.info());
            } else if (i != 26) {
                switch (i) {
                    case 6:
                        jSONLexer.nextToken();
                        return Boolean.TRUE;
                    case 7:
                        jSONLexer.nextToken();
                        return Boolean.FALSE;
                    case 8:
                        jSONLexer.nextToken();
                        return null;
                    case 9:
                        jSONLexer.nextToken(18);
                        if (jSONLexer.token() != 18) {
                            throw new JSONException("syntax error");
                        }
                        jSONLexer.nextToken(10);
                        accept(10);
                        long longValue = jSONLexer.integerValue().longValue();
                        accept(2);
                        accept(11);
                        return new Date(longValue);
                    default:
                        switch (i) {
                            case 20:
                                if (jSONLexer.isBlankInput()) {
                                    return null;
                                }
                                throw new JSONException("unterminated json string, " + jSONLexer.info());
                            case 21:
                                jSONLexer.nextToken();
                                HashSet hashSet = new HashSet();
                                parseArray(hashSet, obj);
                                return hashSet;
                            case 22:
                                jSONLexer.nextToken();
                                TreeSet treeSet = new TreeSet();
                                parseArray(treeSet, obj);
                                return treeSet;
                            case 23:
                                jSONLexer.nextToken();
                                return null;
                            default:
                                throw new JSONException("syntax error, " + jSONLexer.info());
                        }
                }
            } else {
                byte[] bytesValue = jSONLexer.bytesValue();
                jSONLexer.nextToken();
                return bytesValue;
            }
        } else {
            return parseObject(new JSONObject(jSONLexer.isEnabled(Feature.OrderedField)), obj);
        }
    }

    public void config(Feature feature, boolean z) {
        this.lexer.config(feature, z);
    }

    public boolean isEnabled(Feature feature) {
        return this.lexer.isEnabled(feature);
    }

    public JSONLexer getLexer() {
        return this.lexer;
    }

    public final void accept(int i) {
        JSONLexer jSONLexer = this.lexer;
        if (jSONLexer.token() == i) {
            jSONLexer.nextToken();
            return;
        }
        throw new JSONException("syntax error, expect " + JSONToken.name(i) + ", actual " + JSONToken.name(jSONLexer.token()));
    }

    public final void accept(int i, int i2) {
        JSONLexer jSONLexer = this.lexer;
        if (jSONLexer.token() == i) {
            jSONLexer.nextToken(i2);
        } else {
            throwException(i);
        }
    }

    public void throwException(int i) {
        throw new JSONException("syntax error, expect " + JSONToken.name(i) + ", actual " + JSONToken.name(this.lexer.token()));
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        JSONLexer jSONLexer = this.lexer;
        try {
            if (jSONLexer.isEnabled(Feature.AutoCloseSource) && jSONLexer.token() != 20) {
                throw new JSONException("not close json text, token : " + JSONToken.name(jSONLexer.token()));
            }
        } finally {
            jSONLexer.close();
        }
    }

    public Object resolveReference(String str) {
        if (this.contextArray == null) {
            return null;
        }
        int i = 0;
        while (true) {
            ParseContext[] parseContextArr = this.contextArray;
            if (i >= parseContextArr.length || i >= this.contextArrayIndex) {
                break;
            }
            ParseContext parseContext = parseContextArr[i];
            if (parseContext.toString().equals(str)) {
                return parseContext.object;
            }
            i++;
        }
        return null;
    }

    public void handleResovleTask(Object obj) {
        Object obj2;
        List<ResolveTask> list = this.resolveTaskList;
        if (list == null) {
            return;
        }
        int size = list.size();
        for (int i = 0; i < size; i++) {
            ResolveTask resolveTask = this.resolveTaskList.get(i);
            String str = resolveTask.referenceValue;
            Object obj3 = resolveTask.ownerContext != null ? resolveTask.ownerContext.object : null;
            if (str.startsWith("$")) {
                obj2 = getObject(str);
                if (obj2 == null) {
                    try {
                        obj2 = JSONPath.eval(obj, str);
                    } catch (JSONPathException unused) {
                    }
                }
            } else {
                obj2 = resolveTask.context.object;
            }
            FieldDeserializer fieldDeserializer = resolveTask.fieldDeserializer;
            if (fieldDeserializer != null) {
                if (obj2 != null && obj2.getClass() == JSONObject.class && fieldDeserializer.fieldInfo != null && !Map.class.isAssignableFrom(fieldDeserializer.fieldInfo.fieldClass)) {
                    obj2 = JSONPath.eval(this.contextArray[0].object, str);
                }
                fieldDeserializer.setValue(obj3, obj2);
            }
        }
    }

    /* loaded from: classes.dex */
    public static class ResolveTask {
        public final ParseContext context;
        public FieldDeserializer fieldDeserializer;
        public ParseContext ownerContext;
        public final String referenceValue;

        public ResolveTask(ParseContext parseContext, String str) {
            this.context = parseContext;
            this.referenceValue = str;
        }
    }

    public void parseExtra(Object obj, String str) {
        Object parseObject;
        this.lexer.nextTokenWithColon();
        List<ExtraTypeProvider> list = this.extraTypeProviders;
        Type type = null;
        if (list != null) {
            for (ExtraTypeProvider extraTypeProvider : list) {
                type = extraTypeProvider.getExtraType(obj, str);
            }
        }
        if (type == null) {
            parseObject = parse();
        } else {
            parseObject = parseObject(type);
        }
        if (obj instanceof ExtraProcessable) {
            ((ExtraProcessable) obj).processExtra(str, parseObject);
            return;
        }
        List<ExtraProcessor> list2 = this.extraProcessors;
        if (list2 != null) {
            for (ExtraProcessor extraProcessor : list2) {
                extraProcessor.processExtra(obj, str, parseObject);
            }
        }
        if (this.resolveStatus == 1) {
            this.resolveStatus = 0;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:86:0x0238, code lost:
        return r11;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public java.lang.Object parse(com.alibaba.fastjson.parser.deserializer.PropertyProcessable r11, java.lang.Object r12) {
        /*
            Method dump skipped, instructions count: 617
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.alibaba.fastjson.parser.DefaultJSONParser.parse(com.alibaba.fastjson.parser.deserializer.PropertyProcessable, java.lang.Object):java.lang.Object");
    }
}
